package com.jesper.seckill.dao;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jesper.seckill.entity.po.Goods;
import com.jesper.seckill.mapper.GoodsMapper;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class GoodsDao extends ServiceImpl<GoodsMapper, Goods> {

    /**
     * 获取商品列表
     */
    public List<Goods> getGoodsPOList(){
        return lambdaQuery()
                .orderByAsc(Goods::getGoodsPrice)
                .list();
    }

    /**
     * 获取商品分页
     */
    public Page pageGoods(Page page) {
        return lambdaQuery()
                .orderByAsc(Goods::getGoodsPrice)
                .page(page);
    }
}
